.class public Lcom/bitauto/autoeasy/tool/ToolCity;
.super Ljava/lang/Object;
.source "ToolCity.java"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 16
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static DialogCity(Ljava/util/ArrayList;Landroid/content/Context;)Landroid/app/AlertDialog;
    .locals 5
    .parameter
    .parameter "context"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/City;",
            ">;",
            "Landroid/content/Context;",
            ")",
            "Landroid/app/AlertDialog;"
        }
    .end annotation

    .prologue
    .line 55
    .local p0, cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    new-instance v0, Landroid/app/AlertDialog$Builder;

    invoke-direct {v0, p1}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 56
    .local v0, builder:Landroid/app/AlertDialog$Builder;
    const-string v1, "\u9009\u62e9\u57ce\u5e02"

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    .line 57
    invoke-static {p0}, Lcom/bitauto/autoeasy/tool/ToolCity;->ListTOArray(Ljava/util/ArrayList;)[Ljava/lang/String;

    move-result-object v1

    const-string v2, "autoeasy"

    const/4 v3, 0x2

    invoke-virtual {p1, v2, v3}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v2

    const-string v3, "item"

    const/4 v4, 0x0

    invoke-interface {v2, v3, v4}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v2

    new-instance v3, Lcom/bitauto/autoeasy/tool/ToolCity$1;

    invoke-direct {v3, p1, p0}, Lcom/bitauto/autoeasy/tool/ToolCity$1;-><init>(Landroid/content/Context;Ljava/util/ArrayList;)V

    invoke-virtual {v0, v1, v2, v3}, Landroid/app/AlertDialog$Builder;->setSingleChoiceItems([Ljava/lang/CharSequence;ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    .line 65
    invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v1

    return-object v1
.end method

.method public static DialogCity(Ljava/util/ArrayList;Lcom/bitauto/autoeasy/news/NewsActivity;I)Landroid/app/AlertDialog;
    .locals 5
    .parameter
    .parameter "context"
    .parameter "i"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/City;",
            ">;",
            "Lcom/bitauto/autoeasy/news/NewsActivity;",
            "I)",
            "Landroid/app/AlertDialog;"
        }
    .end annotation

    .prologue
    .line 69
    .local p0, cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    new-instance v0, Landroid/app/AlertDialog$Builder;

    invoke-direct {v0, p1}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 70
    .local v0, builder:Landroid/app/AlertDialog$Builder;
    const-string v1, "\u9009\u62e9\u57ce\u5e02"

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    .line 71
    invoke-static {p0}, Lcom/bitauto/autoeasy/tool/ToolCity;->ListTOArray(Ljava/util/ArrayList;)[Ljava/lang/String;

    move-result-object v1

    const-string v2, "autoeasy"

    const/4 v3, 0x2

    invoke-virtual {p1, v2, v3}, Lcom/bitauto/autoeasy/news/NewsActivity;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v2

    const-string v3, "item"

    const/4 v4, 0x0

    invoke-interface {v2, v3, v4}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v2

    new-instance v3, Lcom/bitauto/autoeasy/tool/ToolCity$2;

    invoke-direct {v3, p1, p0}, Lcom/bitauto/autoeasy/tool/ToolCity$2;-><init>(Lcom/bitauto/autoeasy/news/NewsActivity;Ljava/util/ArrayList;)V

    invoke-virtual {v0, v1, v2, v3}, Landroid/app/AlertDialog$Builder;->setSingleChoiceItems([Ljava/lang/CharSequence;ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    .line 80
    invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v1

    return-object v1
.end method

.method public static ExitDialog(Landroid/content/Context;)Landroid/app/Dialog;
    .locals 3
    .parameter "context"

    .prologue
    .line 92
    new-instance v0, Landroid/app/AlertDialog$Builder;

    invoke-direct {v0, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 93
    .local v0, builder:Landroid/app/AlertDialog$Builder;
    const-string v1, "\u9000\u51fa\u7a0b\u5e8f"

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    .line 94
    const-string v1, "\u786e\u5b9a\u8981\u9000\u51fa\u7a0b\u5e8f\u5417\uff1f"

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    .line 95
    const-string v1, "\u786e\u5b9a"

    new-instance v2, Lcom/bitauto/autoeasy/tool/ToolCity$3;

    invoke-direct {v2}, Lcom/bitauto/autoeasy/tool/ToolCity$3;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog$Builder;->setPositiveButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    .line 101
    const-string v1, "\u53d6\u6d88"

    new-instance v2, Lcom/bitauto/autoeasy/tool/ToolCity$4;

    invoke-direct {v2}, Lcom/bitauto/autoeasy/tool/ToolCity$4;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog$Builder;->setNegativeButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    .line 106
    invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->show()Landroid/app/AlertDialog;

    move-result-object v1

    return-object v1
.end method

.method public static ListTOArray(Ljava/util/ArrayList;)[Ljava/lang/String;
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/City;",
            ">;)[",
            "Ljava/lang/String;"
        }
    .end annotation

    .prologue
    .line 84
    .local p0, cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    invoke-virtual {p0}, Ljava/util/ArrayList;->size()I

    move-result v2

    new-array v0, v2, [Ljava/lang/String;

    .line 85
    .local v0, city:[Ljava/lang/String;
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    invoke-virtual {p0}, Ljava/util/ArrayList;->size()I

    move-result v2

    if-lt v1, v2, :cond_0

    .line 88
    return-object v0

    .line 86
    :cond_0
    invoke-virtual {p0, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/bitauto/autoeasy/selectcar/Object/City;

    invoke-virtual {v2}, Lcom/bitauto/autoeasy/selectcar/Object/City;->getCityName()Ljava/lang/String;

    move-result-object v2

    aput-object v2, v0, v1

    .line 85
    add-int/lit8 v1, v1, 0x1

    goto :goto_0
.end method

.method public static downLoadCity(Landroid/content/Context;)V
    .locals 6
    .parameter "context"

    .prologue
    const-string v5, "\u83b7\u53d6\u6570\u636e\u5931\u8d25,\u8bf7\u68c0\u67e5\u7f51\u7edc\u662f\u5426\u8fde\u63a5."

    .line 23
    :try_start_0
    new-instance v1, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;

    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v3

    invoke-virtual {v3}, Landroid/content/res/Resources;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v3

    const-string v4, "citylist"

    invoke-virtual {v3, v4}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v3

    invoke-static {v3}, Lcom/bitauto/autoeasy/tool/ToolBox;->convertStreamToString(Ljava/io/InputStream;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v1, v3}, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;-><init>(Ljava/lang/String;)V

    .line 24
    .local v1, cityParser:Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
    invoke-virtual {v1}, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->Paser2Object()V

    .line 25
    invoke-virtual {v1}, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->getList()Ljava/util/ArrayList;

    move-result-object v0

    .line 26
    .local v0, cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    if-eqz v0, :cond_0

    .line 27
    invoke-static {v0, p0}, Lcom/bitauto/autoeasy/tool/ToolCity;->DialogCity(Ljava/util/ArrayList;Landroid/content/Context;)Landroid/app/AlertDialog;

    move-result-object v3

    invoke-virtual {v3}, Landroid/app/AlertDialog;->show()V

    .line 34
    .end local v0           #cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    .end local v1           #cityParser:Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
    :goto_0
    return-void

    .line 29
    .restart local v0       #cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    .restart local v1       #cityParser:Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
    :cond_0
    const-string v3, "\u83b7\u53d6\u6570\u636e\u5931\u8d25,\u8bf7\u68c0\u67e5\u7f51\u7edc\u662f\u5426\u8fde\u63a5."

    invoke-static {p0, v3}, Lcom/bitauto/autoeasy/tool/ToolBox;->showToast(Landroid/content/Context;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 31
    .end local v0           #cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    .end local v1           #cityParser:Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
    :catch_0
    move-exception v3

    move-object v2, v3

    .line 32
    .local v2, e:Ljava/io/IOException;
    const-string v3, "\u83b7\u53d6\u6570\u636e\u5931\u8d25,\u8bf7\u68c0\u67e5\u7f51\u7edc\u662f\u5426\u8fde\u63a5."

    invoke-static {p0, v5}, Lcom/bitauto/autoeasy/tool/ToolBox;->showToast(Landroid/content/Context;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public static downLoadCity(Lcom/bitauto/autoeasy/news/NewsActivity;I)V
    .locals 6
    .parameter "context"
    .parameter "i"

    .prologue
    const-string v5, "\u83b7\u53d6\u6570\u636e\u5931\u8d25,\u8bf7\u68c0\u67e5\u7f51\u7edc\u662f\u5426\u8fde\u63a5."

    .line 41
    :try_start_0
    new-instance v1, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;

    invoke-virtual {p0}, Lcom/bitauto/autoeasy/news/NewsActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v3

    invoke-virtual {v3}, Landroid/content/res/Resources;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v3

    const-string v4, "citylist"

    invoke-virtual {v3, v4}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v3

    invoke-static {v3}, Lcom/bitauto/autoeasy/tool/ToolBox;->convertStreamToString(Ljava/io/InputStream;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v1, v3}, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;-><init>(Ljava/lang/String;)V

    .line 42
    .local v1, cityParser:Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
    invoke-virtual {v1}, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->Paser2Object()V

    .line 43
    invoke-virtual {v1}, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->getList()Ljava/util/ArrayList;

    move-result-object v0

    .line 44
    .local v0, cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    if-eqz v0, :cond_0

    .line 45
    invoke-static {v0, p0, p1}, Lcom/bitauto/autoeasy/tool/ToolCity;->DialogCity(Ljava/util/ArrayList;Lcom/bitauto/autoeasy/news/NewsActivity;I)Landroid/app/AlertDialog;

    move-result-object v3

    invoke-virtual {v3}, Landroid/app/AlertDialog;->show()V

    .line 52
    .end local v0           #cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    .end local v1           #cityParser:Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
    :goto_0
    return-void

    .line 47
    .restart local v0       #cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    .restart local v1       #cityParser:Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
    :cond_0
    const-string v3, "\u83b7\u53d6\u6570\u636e\u5931\u8d25,\u8bf7\u68c0\u67e5\u7f51\u7edc\u662f\u5426\u8fde\u63a5."

    invoke-static {p0, v3}, Lcom/bitauto/autoeasy/tool/ToolBox;->showToast(Landroid/content/Context;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 49
    .end local v0           #cityList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/City;>;"
    .end local v1           #cityParser:Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
    :catch_0
    move-exception v3

    move-object v2, v3

    .line 50
    .local v2, e:Ljava/io/IOException;
    const-string v3, "\u83b7\u53d6\u6570\u636e\u5931\u8d25,\u8bf7\u68c0\u67e5\u7f51\u7edc\u662f\u5426\u8fde\u63a5."

    invoke-static {p0, v5}, Lcom/bitauto/autoeasy/tool/ToolBox;->showToast(Landroid/content/Context;Ljava/lang/String;)V

    goto :goto_0
.end method
